home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 July / macformat-026.iso / mac / Shareware City / Science / µSim 1.0 folder / Libs / CursorBalloon.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-01-17  |  3.0 KB  |  92 lines  |  [TEXT/MMCC]

  1. #ifndef __FABCURSORBALLOON__
  2. #define __FABCURSORBALLOON__
  3.  
  4. /* this distinguishes a normal window from a window with objects */
  5.  
  6. enum windowclasses {
  7. kFabWindowClass = 10
  8. };
  9.  
  10. /* this is my window record, containing the standard Dialog Manager record,
  11. the procedures normally called when handling events (if you do not want to
  12. undertake special actions i.e. for dragging, pass nil), the number of
  13. objects, and a Handle to the objects */
  14.  
  15. typedef struct RgnBalloonCurs RgnBalloonCurs;
  16. typedef RgnBalloonCurs *RgnBalloonCursPtr;
  17. typedef RgnBalloonCursPtr *RgnBalloonCursHandle;
  18.  
  19. struct FabWindowRecord {
  20.     DialogRecord    w;
  21.     void (*activateProc)(EventRecord *, WindowPtr, Boolean);
  22.     void (*updateProc)(WindowPtr);
  23.     void (*dragProc)(WindowPtr);
  24.     void (*growProc)(WindowPtr, EventRecord *);
  25.     void (*zoomProc)(WindowPtr);
  26.     void (*goAwayProc)(WindowPtr);
  27.     void (*contentProc)(WindowPtr, EventRecord *);
  28.     void (*getDragHiliteRectProc)(WindowPtr, RectPtr);
  29.     Boolean (*canIAcceptDrag)(const HFSFlavor *);
  30.     OSErr (*dragReaction)(WindowPtr, const HFSFlavor *);
  31.     unsigned long    objCount;
  32.     DragTrackingHandlerUPP    trackUPP;
  33.     DragReceiveHandlerUPP    recUPP;
  34.     RgnBalloonCursHandle    myZones;
  35.     };
  36.  
  37. typedef struct FabWindowRecord FabWindowRecord;
  38. typedef FabWindowRecord *FabWindowPtr;
  39.  
  40. /* this is a generic object belonging to a window */
  41.  
  42. struct RgnBalloonCurs {
  43.     void (*recalcRgnProc)(FabWindowPtr, RgnBalloonCursPtr);
  44.     RgnHandle    zoneLocal;
  45.     RgnHandle    zoneGlobal;
  46.     CursHandle    curs;
  47.     unsigned long    myBalloon;
  48.     short        balloonVariant;
  49.     short        itemID;
  50.     };
  51.  
  52.  
  53. OSErr InstallRgnHandler(FabWindowPtr w, RgnHandle whichRgn, void (*recalcProc)(FabWindowPtr, RgnBalloonCursPtr),
  54.                         CursHandle cursor,
  55.                         unsigned long balloon, short ballnVariant, short iID);
  56. void RecalcMouseRegion(WindowPtr w, Point mouse);
  57. void ResizeObjects(FabWindowPtr w);
  58. void RecalcGlobalCoords(FabWindowPtr w);
  59. void DisposFabWindow(FabWindowPtr w);
  60. void ForceMouseMovedEvent(void);
  61. void InitFabWindow(FabWindowPtr w);
  62.  
  63. /* useful macros */
  64.  
  65. #define toBalloon(m, i)        (((long)m << 16) + i)
  66.  
  67. #define Zones(w)            (((FabWindowPtr)w)->myZones)
  68.  
  69. /* macros for setting the event handlers for the window, and
  70. prototypes of the handlers */
  71.  
  72. #define SetActivate(w, p)    ((FabWindowPtr)w)->activateProc = p
  73. #define SetUpdate(w, p)        ((FabWindowPtr)w)->updateProc = p
  74. #define SetDrag(w, p)        ((FabWindowPtr)w)->dragProc = p
  75. #define SetGrow(w, p)        ((FabWindowPtr)w)->growProc = p
  76. #define SetZoom(w, p)        ((FabWindowPtr)w)->zoomProc = p
  77. #define SetGoAway(w, p)        ((FabWindowPtr)w)->goAwayProc = p
  78. #define SetContent(w, p)    ((FabWindowPtr)w)->contentProc = p
  79. #define SetGetDragRect(w, p)    ((FabWindowPtr)w)->getDragHiliteRectProc = p
  80. #define SetCanIAcceptDrag(w, p)    ((FabWindowPtr)w)->canIAcceptDrag = p
  81. #define SetDragReaction(w, p)    ((FabWindowPtr)w)->dragReaction = p
  82.  
  83. #define NumObjects(w)        (((FabWindowPtr)w)->objCount)
  84. #define OneMoreObject(w)    (((FabWindowPtr)w)->objCount++)
  85.  
  86. #define IsFabWindow(w)        (w && (((WindowPeek)w)->windowKind == kFabWindowClass || (isMovableModal(w) && GetPtrSize((Ptr)w) > sizeof(DialogRecord))))
  87.  
  88. extern RgnHandle    mouseRgn, wideOpenRgn;
  89.  
  90. #endif
  91.  
  92.